<script>

  function Is_Wx_Al() {
    var ua = window.navigator.userAgent;
    if (/MicroMessenger/.test(ua)) {
      return 'wxpay';
    } else if (/AlipayClient/.test(ua)) {
      return 'alipay';
    } else {
      return '其他浏览器';
    }
  }
</script>
<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" />
  <title>在线支付 - 支付宝 - 网上支付 安全快速！</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
  <style>
    body {
      background: #f2f2f4;
    }

    body,
    html {
      width: 100%;
      height: 100%;
    }

    *,
    :after,
    :before {
      box-sizing: border-box;
    }

    * {
      margin: 0;
      padding: 0;
    }

    img {
      max-width: 100%;
    }

    #header {
      height: 60px;
      border-bottom: 2px solid #eee;
      background-color: #fff;
      text-align: center;
      line-height: 60px;
    }

    #header h1 {
      font-size: 20px;
    }

    #main {
      overflow: hidden;
      margin: 0 auto;
      padding: 20px;
      padding-top: 80px;
      width: 992px;
      max-width: 100%;
    }

    #main .left {
      float: left;
      width: 40%;
      box-shadow: 0 0 60px #b5f1ff;
    }

    .left p {
      margin: 10px auto;
    }

    .make {
      padding-top: 15px;
      border-radius: 10px;
      background-color: #fff;
      box-shadow: 0 3px 3px 0 rgba(0, 0, 0, .05);
      color: #666;
      text-align: center;
      transition: all .2s linear;
    }

    .make .qrcode {
      margin: auto;
    }

    .make .money {
      margin-bottom: 0;
      color: #f44336;
      font-weight: 600;
      font-size: 18px;
    }

    .info {
      padding: 15px;
      width: 100%;
      border-radius: 0 0 10px 10px;
      background: #32343d;
      color: #f2f2f2;
      text-align: center;
      font-size: 14px;
    }

    #main .right {
      float: right;
      padding-top: 25px;
      width: 60%;
      color: #ccc;
      text-align: center;
    }

    @media (max-width:768px) {
      #main {
        padding-top: 30px;
      }

      #main .left {
        width: 100%;
      }

      #main .right {
        display: none;
      }
    }
  </style>
  <link rel="stylesheet" type="text/css" href="/Submit/Template/default/assets/css/qrcode.css">
</head>

<body>

  <div id="main">
    <div class="left">
      <div class="make">
        <p><img src="/Submit/Template/default/assets/img/alipay-logo.png" alt="" style="height:30px;"></p>
        <p>商品名称：库存管理员</p>
        <p class="money" id="price" style="font-weight:bold; color:green">0.10</p>
        <center>
          <p class="qrcode" id="qrcode">
            <img id="qrcode_load" src="/Submit/Template/default/assets/img/loading.gif" style="display: block;"></img>
          </p>
        </center>
        <center>
          <a id="alipayh5url_1"></a>
          <a id="alipayh5url_2"></a>
        </center>
        <div class="info">
          <a id="copy_p" style="color: red;font-size: 15px;word-break: keep-all;">【复制金额】</a>
          <p id="divTime">正在获取二维码,请稍等...</p>
          <p>商户联系方式：QQ123456789/微信:xxxx</p>
          <p>商户订单号：2025030615253091722</p>
          <!--<p>联系QQ：1379605323</p>-->
          <p>请使用支付宝扫一扫</p>
          <span style="color: green">商户已完成实名认证,请放心支付</span>
        </div>
      </div>
    </div>
    <div class="right">
      <img src="/Submit/Template/default/assets/img/alipay-sys.png" alt="">
    </div>
  </div>
</body>

</html>
<script src="/Submit/Template/default/assets/js/clipboard.min.js"></script>
<script type="text/javascript" src="/Submit/Template/default/assets/js/qrcode.min.js"></script>
<script type="text/javascript" src="/Submit/Template/default/assets/js/jquery.min.js"></script>
<script type="text/javascript" src="/Submit/Template/default/assets/layer/layer.js"></script>
<script>
  var clipboard = new Clipboard('#copy_p', {
    text: function () {
      return $("#price").text();
    }
  });

  clipboard.on('success', function (e) {
    layer.msg("复制成功,请使用复制金额付款");
  });

  clipboard.on('error', function (e) {
    document.querySelector('#price');
    layer.msg("复制失败,请手动复制一下");
  });


</script>
<script type="text/javascript">
  var intDiff = parseInt('40');//倒计时总秒数量
  function timer(intDiff) {
    window.setInterval(function () {
      var day = 0,
        hour = 0,
        minute = 0,
        second = 0;//时间默认值       
      if (intDiff > 0) {
        day = Math.floor(intDiff / (60 * 60 * 24));
        hour = Math.floor(intDiff / (60 * 60)) - (day * 24);
        minute = Math.floor(intDiff / 60) - (day * 24 * 60) - (hour * 60);
        second = Math.floor(intDiff) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
      }
      if (minute <= 9) minute = '0' + minute;
      if (second <= 9) second = '0' + second;
      if (hour <= 0 && minute <= 0 && second <= 0) {
        $("#divTime").html("<small style='color:red; font-size:26px'>订单二维码已过期</small>");
        $("#qrcode").html('<img id="qrcode_load" src="/Submit/Template/default/assets/img/qrcode_timeout.png">');//输出过期二维码提示图片
      } else {
        $("#divTime").html("二维码有效时间:<small style='color:red; font-size:26px'>" + minute + "</small>分<small style='color:red; font-size:26px'>" + second + "</small>秒,失效勿付");
      }
      intDiff--
    }, 1000);
  }

  $(function () {
    timer(intDiff);
  });


  order();
  updateQrOk = 0;
  updateQrImg = 0;
  updateQrNo = 0;
  //周期监听 
  orderlst = window.setInterval(function () {
    order();
  }, 1000);
  //订单监控  {订单监控}
  $("#qrcode").html('<img id="qrcode_load" src="">');
  if (window.navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)) {
    $("#alipayh5url_1").html('<small> <font color=red style="font-size:16px">如果无法跳转请扫码</font></div></small> <a type="button" href="alipayqr://platformapi/startapp?saId=10000007&qrcode=https%3A%2F%2Fds.alipay.com%2F%3Ffrom%3Dpc%26appId%3D20000116%26actionType%3DtoAccount%26goBack%3DNO%26amount%3D0.10%26userId%3D2088222861215548%26memo%3D2025030615253091722" class="btn btn-lg btn-block btn-success" style="font-size:13px" target="_blank">唤醒支付宝APP支付[免输入金额]</a>');//H5按钮1
  }
  function order() {
    $.get("Mcode_Get.php", { trade_no: "2025030615253091722" }, function (result) {
      //成功
      if (result.code == '200' && updateQrOk == 0) {
        updateQrOk == 1;
        $("#divTime").html("<small style='color:red; font-size:22px'>" + result.msg + "</small>");
        //$("#divMsg_a").html(result.msg);//输出提醒1
        //$("#divMsg_b").html(result.msg);//输出提醒2
        $("#qrcode").html('<img id="qrcode_load" src="/Submit/Template/default/assets/img/pay_ok.png">');//输出过期二维码提示图片
        //回调页面
        window.location.href = result.data.backurl;
        window.clearInterval(orderlst);
        layer.msg('支付成功，正在跳转中...');
      }
      //支付二维码
      if (result.code == '100' && updateQrImg == 0) {
        updateQrImg = 1;
        var pay_type = 'alipay';//支付方式
        var is_money = 0.10;
        if (is_money != result.data.money) {
          layer.alert('温馨提示:' + is_money + '金额已被其他用户金额占用,请您务必付款<font color=red>' + result.data.money + '</font>元,<font color=red>多付一分或者少付一分都不能到账</font>!', {
            icon: 1,
            skin: 'layer-ext-moon' //该皮肤由layer.seaning.com友情扩展。关于皮肤的扩展规则，去这里查阅
          });
        }

        //$("#divMsg_a").html("禁止使用花呗付款,否则不能自动到账!");//输出提醒1
        //$("#divMsg_b").html("遇无法支付的二维码,请返回重新充值!");//输出提醒2
        $('#price').html('¥' + result.data.money + '<font color=red style="font-size:8px">(不可多付或少付)</font>');//输出真实付款金额

        if (pay_type == "alipay") {


        }
        if (pay_type == "wxpay") {
          if (window.navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i)) {
            var isiOS = !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
            // if(isiOS){
            $("#alipayh5url_1").html('<small> <font color=red style="font-size:16px">如果无法跳转请扫码</font></div></small> <a type="button" href="#" onclick="leave_h5_wx()" class="btn btn-lg btn-block btn-success" style="font-size:13px">唤醒支付</a>');//H5按钮1
            // }else{
            $("#alipayh5url_1").html('<small> <font color=red style="font-size:16px">如果无法跳转请扫码</font></div></small> <a type="button" href="weixin://" class="btn btn-lg btn-block btn-success" style="font-size:13px" target="_blank">截图后唤醒微信APP扫码</a>');//H5按钮1
            // }
          }
        }
        //设置参数方式 
        /*
        $('#qrcode_load').remove();//隐藏等待图片
         var qrcode = new QRCode('qrcode', {
           text: result.data.qrcode, 
           width: 256, 
           height: 256, 
           colorDark : '#000000', 
           colorLight : '#ffffff', 
           correctLevel : QRCode.CorrectLevel.H 
         });
        */
      }
      //订单已经超时
      if (result.code == '-1' && updateQrNo == 0) {
        updateQrNo == 1;
        $("#divTime").html("<small style='color:red; font-size:22px'>" + result.msg + "</small>");
        //$("#divMsg_a").html(result.msg);//输出提醒1
        //$("#divMsg_b").html(result.msg);//输出提醒2
        window.clearInterval(orderlst);
        layer.confirm(result.msg, {
          icon: 2,
          title: '支付失败',
          btn: ['确认'] //按钮
        }, function () {
          location.href = result.data.backurl
        });
      }

    }, "JSON");
  }
  function Report_prompt() {
    //prompt层
    layer.prompt({ title: '请输入违规内容', formType: 2, btn: ['提交', '取消'] }, function (text, index) {
      layer.close(index);
      $.ajax({
        type: "POST",
        dataType: "json",
        url: "/api.php?act=order_report",
        timeout: 10000, //ajax请求超时时间10s
        data: { pid: "1000", text: text, out_trade_no: "20210508135729623", product_name: "测试商品" }, //post数据
        success: function (data, textStatus) {
          //从服务器得到数据，显示数据并继续查询
          layer.msg(data.msg);
        },
      });
    });
  };
</script>

</body>

</html>